package com.ruoyi.common.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

/**
 * @Author: wwy
 * @Date: 2020/11/20 8:48
 */
public class PropertiesReadUtil {
    private static final Logger LOGGER = LoggerFactory.getLogger(PropertiesReadUtil.class);
    static Properties aliProperties = new Properties();
    static {

        // 使用ClassLoader加载properties配置文件生成对应的输入流
        InputStream in = PropertiesReadUtil.class.getClassLoader().getResourceAsStream("aliSms.properties");
        BufferedInputStream bf = new BufferedInputStream(in);
        // 使用properties对象加载输入流
        try {
            aliProperties.load(new InputStreamReader(bf,"gbk"));
            LOGGER.info("阿里云短信配置信息初始化：{}",aliProperties.toString());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static Properties getAliProperties(){
        return aliProperties;
    }

}
